package cn.lili.controller.system.goods_auth;

import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods_auth.service.GoodsAuthOpenApiService;
import cn.lili.modules.system.entity.dos.GoodsAuthOpen;
import cn.lili.modules.system.entity.dos.GoodsAuthOpenCallback;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(value = "授权商品开放接口")
@Slf4j
@RestController
@RequestMapping("/system/goodsAuth")
public class GoodsAuthOpenApiController {

    @Resource
    private GoodsAuthOpenApiService goodsAuthOpenApiService;

    @ApiModelProperty(value = "拉取商品")
    @PostMapping ("/getGoods")
    public ResultMessage<Object> getAuthGoods(@RequestBody GoodsAuthOpen goodsAuthOpen) throws Exception {
        return goodsAuthOpenApiService.getAuthGoods(goodsAuthOpen);
    }

    @ApiModelProperty(value = "商品变动")
    @PostMapping ("/callBackGoods")
    public ResultMessage<Object> callBackGoods(@RequestBody GoodsAuthOpenCallback callback){
        return goodsAuthOpenApiService.callBackGoods(callback);
    }
}
